package com.yzt.sys.service.impl;

import com.yzt.sys.entity.UserRole;
import com.yzt.sys.mapper.UserRoleMapper;
import com.yzt.sys.service.IUserRoleService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yzt.base.service.impl.BaseServiceImpl;

import java.util.List;

import org.springframework.stereotype.Service;

/**
 * <p>
 * 用户_角色关联表 服务实现类
 * </p>
 *
 * @author Y
 * @since 2021-01-21
 */
@Service
public class UserRoleServiceImpl extends BaseServiceImpl<UserRoleMapper, UserRole> implements IUserRoleService {

	@Override
	public List<Long> getRoleIds(Long userId) {
		List<Long> roleIds = this.listObjs(
				Wrappers.<UserRole>lambdaQuery().select(UserRole::getRoleId).eq(UserRole::getUserId, userId), a -> {
					return Long.valueOf(a.toString());
				});
		return roleIds;
	}

}
